
#ifndef __FR_WATCH_H__
#define __FR_WATCH_H__

#include "lvgl.h"
#include "user_ipc_st.h"

#include "fr_ui_node.h"
#include "fr_frame.h"
#include "lv_user_sqstack.h"

#define  I16 signed short




typedef enum
{
	M3_DRIVER_CALLING = 1,
	M3_DRIVER_CALLING_CANCE = 2,
	M3_DRIVER_CALLING_OK = 3,
	M3_DRIVER_CALLING_STATE = 4,

}phone_call_t;


typedef enum
{

	M3_DRIVER_MESSAGE_INPUT = 7,
	M3_DRIVER_CTP_INPUT = 8,
	M3_DRIVER_KEY_INPUT = 9,
	M3_DRIVER_DAILY_DATA = 10,
	M3_DRIVER_MESSAGE_INFO = 11,	
	M3_DRIVER_CAllLIST_INFO = 12,
    M3_MUSIC_CONTROL = 13,
	M3_DRIVER_OTA_STEP = 14,
	M3_DRIVER_UI_JUMP = 15,
	M3_DRIVER_UI_REMIND = 16,
	//new add
	M3_DRIVER_HISTORY_DATA = 17,
	M3_DRIVER_TEST_DATA = 18,
	#if ALIPAY_FUNC_ENABLE
	M3_DRIVER_UPAY_DATA= 19,
	#endif
	M3_DRIVER_SEND_DATA = 20,// 切换主表盘ID
	DSP_INTERNAL_EVENT = 21,
	
	DSP_CALLOUT_EVENT = 22,	
}watch_ipc_msg_type_t;



//byte[0] 1开关心�? byte[1]:0关闭心率	1开启心�?
//byte[0] 2开关血�? byte[1]:0关闭血�?1开启血�?
//byte[0] 3开关血�? byte[1]:0关闭血�?1开启血�?
//byte[0] 4马达震动  byte[1]:0关闭震动     1开启震�? byte[2]:震动次数
//byte[0] 5查找手机  byte[1]:1查找手机
//byte[0] 6音乐播放暂停，根据AVRCP的状�?get_avrcp_work_state();0:停止  1:开�? 2:暂停
//byte[0] 7音乐暂停�?
//byte[0] 8音乐停止
//byte[0] 9上一�?
//byte[0] 10下一�?
//byte[0] 11音量++
//byte[0] 12音量--
//byte[0] 13拨号	byte[1......12]参数带拨号号�?长度+13714106071
//byte[0] 14接听
//byte[0] 15拒接
//byte[0] 16重拨
//byte[0] 17静音	目前功能无效续作优化
//byte[0] 18关机
//byte[0] 19复位
//byte[0] 20重启
//byte[0] 21开关抬腕亮�? byte[1]:0关闭抬腕亮屏	1开启抬腕亮�?
//byte[0] 22设置亮屏时间  byte[1]:
//byte[0] 23设置亮度调节  byte[1]:亮度等级
//byte[0] 24语言设置         byte[1]:参看枚举类型定义
//byte[0] 25闹钟开�?        byte[1]:
//byte[0] 26: 秒表控制        byte[1]:1开�? 2暂停 0关闭	 
//byte[0] 27: 运动模式控制  byte[1]:1开�?2暂停 0停止保存数据
//byte[0] 28: 拍照
//byte[0] 29: 开关背�?
//byte[0] 30: 是否延迟闹钟10分再次触�?
//byte[0] 31: 倒计�?          byte[1]:1开�? 2暂停 0关闭
//byte[0] 32: 同步byte[1]:1心率 byte[2]心率�?   同步byte[1]:2血压byte[2]低压byte[3]高压	同步byte[1]:3血氧byte[2]血氧�?到APP
//byte[0] 33: APP切换表盘
//byte[0] 34: 语音助手
//byte[0] 35: 主动开关音频蓝牙开�?，byte[1] 1：开启音频蓝�? 0：关闭音频蓝�?

typedef enum
{
   	DSP_EVT_NULL = 0,
  	DSP_EVT_HEART,				// 1		byte[0] 1��������  byte[1]:0�ر�����	1��������
   	DSP_EVT_BLOOD,				// 2		byte[0] 2����Ѫѹ  byte[1]:0�ر�Ѫѹ	1����Ѫѹ
   	DSP_EVT_OXYGEN,			// 3		byte[0] 3����Ѫ��  byte[1]:0�ر�Ѫ��	1����Ѫ��
	DSP_EVT_MOTOR,				// 4		byte[0] 4������  byte[1]:0�ر���     1������  byte[2]:�𶯴���
	DSP_EVT_FIND,				// 5		byte[0] 5�����ֻ�  byte[1]:1�����ֻ�

	#if 0
	DSP_EVT_MUSIC_PLAY,		// 6		byte[0] 6���ֲ�����ͣ������AVRCP��״̬ get_avrcp_work_state();0:ֹͣ  1:����  2:��ͣ
	DSP_EVT_MUSIC_PAUSE,		// 7		byte[0] 7������ͣ��
	DSP_EVT_MUSIC_STOP,		// 8		byte[0] 8����ֹͣ
	DSP_EVT_MUSIC_FORWARD,	// 9		byte[0] 9��һ��
	DSP_EVT_MUSIC_BACKWARD,	// 10		byte[0] 10��һ��
	DSP_EVT_MUSIC_VALUME_UP,	// 11		byte[0] 11����++
	DSP_EVT_MUSIC_VALUME_DOWN,// 12	byte[0] 12����--

	DSP_EVT_DIAL_NUM,			//13		byte[0] 13����	byte[1......12]���������ź��� ����+13714106071
	DSP_EVT_CALL_ANSWER,		//14		byte[0] 14����
	DSP_EVT_CALL_REJECT,		//15		byte[0] 15�ܽ�
	DSP_EVT_CALL_REDIAL,		//16		byte[0] 16�ز�
	DSP_EVT_CALL_MUTE,			//17		byte[0] 17����	Ŀǰ������Ч�����Ż�
	#endif

	DSP_EVT_SYSTEM_SHUTDOWN,	//18		byte[0] 18�ػ�
	DSP_EVT_SYSTEM_RESET,		//19		byte[0] 19��λ
	DSP_EVT_SYSTEM_REBOOT,		//20		byte[0] 20����
	DSP_EVT_WIRST,				//21		byte[0] 21����̧������  byte[1]:0�ر�̧������	1����̧������
	DSP_EVT_LIGHT_TIME,			//22		byte[0] 22��������ʱ��  byte[1]:
	DSP_EVT_BRIGHT,				//23		byte[0] 23�������ȵ���  byte[1]:���ȵȼ�
	DSP_EVT_SYSTEM_LANGUAGE,	//24		byte[0] 24��������         byte[1]:�ο�ö�����Ͷ���
	DSP_EVT_ALARM,				//25		byte[0] 25���ӿ���         byte[1]:
	DSP_EVT_WATCHSTOP_TIME,	//26   	byte[0] 26: �������?       byte[1]:1����  2��ͣ 3�������? 0�ر�	 
	DSP_EVT_SPORTS,				//27		byte[0] 27: �˶�ģʽ����  byte[1]:1��ʼ 2��ͣ 0ֹͣ��������
	DSP_EVT_CAMERA,			//28		byte[0] 28: ����
	DSP_EVT_SWATCH_BRIGHT,	//29		byte[0] 29: ���ر���
	DSP_EVT_ALARM_DELAY,		//30		byte[0] 30: �Ƿ��ӳ�����10���ٴδ���
	DSP_EVT_TIMER_TIME,			//31		byte[0] 31: ����ʱ	          byte[1]:1����  2��ͣ 0�ر�
	DSP_EVT_SYNC_HERAT_BLOOD_OXYGEN,//32 byte[0] 32: ͬ��byte[1]:1���� byte[2]����ֵ    ͬ��byte[1]:2Ѫѹbyte[2]��ѹbyte[3]��ѹ	ͬ��byte[1]:3Ѫ��byte[2]Ѫ��ֵ ��APP
	DSP_EVT_SELECT_WATCH_INDEX,//33	byte[0] 33: �ֻ������л�����
	DSP_EVT_SYSTEM_SIRI,		//34		byte[0] 34: ��������
	DSP_EVT_BT_SWATCH,			//35		byte[0] 35: ����������Ƶ�������� ��byte[1] 1��������Ƶ����  0���ر���Ƶ����


	//enzon
    DSP_EVT_LOAD_PHONE_BOOK,
    DSP_EVT_BT_A2DP_CONTROL,
    DSP_EVT_MUSIC_CONTROL,
	DSP_EVT_CALL_CONTROL,
	DSP_EVT_BT_VALUME_UP,
	DSP_EVT_BT_VALUME_DOWN,
	DSP_EVT_READ_MSG_LIST,
	DSP_EVT_READ_PHONE_BOOK_LIST,
	DSP_EVT_READ_CALL_NAME,
	DSP_EVT_DISTURB_CONTROL,
	DSP_EVT_SET_PHONE_BOOK_ID_OFFSET,
	DSP_EVT_SET_BT_VALUME,
	DSP_EVT_MIC_MUTE,
	DSP_EVT_MIC_OPEN,
	DSP_EVT_CLEAR_LIGHT_TIME,
	DSP_EVT_GET_HISTORY_DATA,
	DSP_EVT_GET_CALL_STATE,
  	DSP_EVT_SET_CARD_INDEX,		//自定义卡�?
  	DSP_EVT_LOW_POWER_MODE,
  	DSP_EVT_DSP_VERSION,
  	DSP_EVT_GET_TEST_DATA,
  	DSP_EVT_BREATHE,

	DSP_EVT_DATA_SEND_BLE,
	DSP_EVT_CAMERA_CONTROL,
	DSP_EVT_PRINTF,
	DSP_EVT_READ_PHONE_BOOK_TOTAL,
	DSP_EVT_TURN_ON_BACKLIGHT,

}_DSP_COMMADE_T;



#define  MESSAGE_MAX_LENGTH     200
#define  MAX_MSG_CONTEXT_LEN    MESSAGE_MAX_LENGTH - 17

typedef struct
{
    uint8_t msg_type;
    uint8_t data_len;
    uint8_t msg_time[15];
    //1 byte(title len) + n byte(title) + 1 byte (context leng)+ n byte(context)
    uint8_t msg_context[MAX_MSG_CONTEXT_LEN];
    
} info_msg_t;


#define  MAX_MSG_LIST   5

typedef struct
{
    uint8_t msg_tatol;
    uint8_t fifo_head;
    uint8_t fifo_tail;
    info_msg_t fifo[MAX_MSG_LIST];
} ancs_msg_t;


//ancs 
typedef struct
{
    uint8_t  msg_type;
	uint16_t  title_len;
    uint8_t  msg_title[128];
	uint16_t  context_len;
    uint8_t  msg_context[512];
	uint16_t time_len;
    uint8_t  msg_time[32];
}ancs_t;


typedef struct
{
    uint8_t  story_state;
	uint8_t  number_len;
    uint8_t  call_namber[32];
	uint8_t  name_len;
    uint8_t  call_name[128];
	uint8_t  time_len;
    uint8_t  msg_time[32];
}call_info_t;


#define  CALL_NUMBER_MAX_LEN    96
#define CALL_RECORD_LIST_MAX    10

typedef struct
{
    uint8_t call_state;
    uint8_t call_context[CALL_NUMBER_MAX_LEN - 1];
    
} card_record_t;


#define  MAX_MSG_LIST   5

typedef struct
{
    uint8_t call_record_total;
    card_record_t fifo[CALL_RECORD_LIST_MAX];
} call_record_list_t;




//tp define here!

typedef enum
{
	CTP_PEN_DOWN,
	CTP_PEN_UP,
	CTP_PEN_MOVE,
	CTP_PEN_MOVE_DOWN,
	CTP_PEN_MOVE_UP,
	CTP_PEN_MOVE_LEFT,
	CTP_PEN_MOVE_RIGHT,
	CTP_PEN_LONG_PRESS,
}ctp_status_t;





typedef struct
{

	uint8_t status;
	uint8_t ctp_status;
	signed short pendown_pos_x;
	signed short pendown_pos_y;
	signed short cur_pos_x;
	signed short cur_pos_y;
	signed short  dx;
	signed short  dy;

}ctp_type_t;






typedef enum 
{
	TP_MSG_INPUT,
	APP_MSG_INPUT,

}watch_msg_id_t;


//massage 
typedef struct 
{
	int msg_id;
	int param1;
	void *param2;
}app_msg_t;



typedef struct
{
	//bool start_flag;
	uint8_t start_flag;
	uint32_t counter;
	uint32_t pen_timeout_counter;
	uint32_t delaycounter;

}ctp_timer_t;



//win coordinate

typedef struct
{

	uint8_t col;
	uint8_t rol;
	
}win_pos_t;

typedef struct
{
	uint32_t	EnterSleepTime;
	uint32_t	ExitSleepTime;
	uint16_t	SleepData[31];
}sleep_history_stru;


//----------------------------clock-ui---------------------------------
typedef void (*  p_main_clock)(lv_obj_t * obj);


typedef lv_obj_t * (*p_lv_obj_create)(lv_obj_t * parent);
typedef void (* p_lv_obj_clean)(lv_obj_t * obj);

//style
typedef void (* p_lv_obj_set_style_bg_color)(lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
typedef void (* p_lv_obj_set_style_pad_all)(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
typedef void (* p_lv_obj_set_style_radius)(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
typedef void (* p_lv_obj_set_style_border_width)(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);



//obj prop
typedef void (* p_lv_obj_set_size)(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
typedef void (* p_lv_obj_align)(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
typedef void (* p_lv_obj_align_to)(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
typedef void (* p_lv_obj_set_pos)(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
typedef void (* p_lv_obj_set_scrollbar_mode)(lv_obj_t * obj, lv_scrollbar_mode_t mode);

//img
typedef lv_obj_t * (*p_lv_img_create)(lv_obj_t * parent);
typedef void (* p_lv_img_set_src)(lv_obj_t * obj, const void * src);
typedef void (* p_lv_img_set_pivot)(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
typedef void (* p_lv_img_set_angle)(lv_obj_t * obj, int16_t angle);

//timer
typedef lv_timer_t * (* p_lv_timer_create)(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data);
typedef void (* p_lv_timer_del)(lv_timer_t * timer);


//event
typedef struct _lv_event_dsc_t * (* p_lv_obj_add_event_cb)(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
typedef lv_res_t (* p_lv_event_send)(lv_obj_t * obj, lv_event_code_t event_code, void * param);
typedef lv_event_code_t (* p_lv_event_get_code)(lv_event_t * e);
typedef lv_obj_t * (* p_lv_event_get_target)(lv_event_t * e);
typedef void * (* p_lv_event_get_param)(lv_event_t * e);
typedef void * (* p_lv_event_get_user_data)(lv_event_t * e);

//parent and child
typedef uint32_t (* p_lv_obj_get_child_id)(const lv_obj_t * obj);
typedef lv_obj_t * (* p_lv_obj_get_parent)(const lv_obj_t * obj);
typedef lv_obj_t * (* p_lv_obj_get_child)(const lv_obj_t * obj, int32_t id);

//label
typedef lv_obj_t * (* p_lv_label_create)(lv_obj_t * parent);
typedef void (* p_lv_label_set_text)(lv_obj_t * obj, const char * text);
typedef void (* p_lv_obj_set_style_text_font)(lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector);



typedef void (* p_lv_mainUI_select_entry)(lv_obj_t * obj);

//line & arc
typedef void (* p_lv_style_init)(lv_style_t * style);
typedef void (* p_lv_style_set_line_width)(lv_style_t * style, lv_coord_t value);
typedef void (* p_lv_style_set_line_color)(lv_style_t * style, lv_color_t value);
typedef void (* p_lv_style_set_line_rounded)(lv_style_t * style, bool value);
typedef lv_obj_t * (* p_lv_line_create)(lv_obj_t * parent);
typedef void (* p_lv_line_set_points)(lv_obj_t * obj, const lv_point_t points[], uint16_t point_num);
typedef void (* p_lv_obj_add_style)(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
typedef lv_obj_t * (* p_lv_arc_create)(lv_obj_t * parent);
typedef void (* p_lv_obj_set_style_arc_width)(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
typedef void (* p_lv_obj_set_style_arc_color)(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
typedef void (* p_lv_arc_set_end_angle)(lv_obj_t * obj, uint16_t end);
typedef void (* p_lv_arc_set_bg_angles)(lv_obj_t * obj, uint16_t start, uint16_t end);


typedef int16_t (* p_lv_trigo_sin)(int16_t angle);
typedef int16_t (* p_lv_trigo_cos)(int16_t angle);

typedef void (* p_lv_label_set_text_fmt)(lv_obj_t * obj, const char * fmt, ...);

typedef bool (* p_lv_font_get_glyph_dsc_fmt_txt)(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter,uint32_t unicode_letter_next);

typedef const uint8_t * (* p_lv_font_get_bitmap_fmt_txt)(const lv_font_t * font, uint32_t unicode_letter);

typedef uint32_t (* p_lv_tick_get)(void);

typedef bool (* p_lv_obj_is_valid)(const lv_obj_t * obj);
typedef uint8_t (* p_fr_system_get_time_week)(void);

typedef void (* p_lv_obj_set_style_text_color)(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);

//new
typedef void (* p_lv_obj_remove_style)(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
typedef void (* p_lv_arc_set_angles)(lv_obj_t * arc, uint16_t start, uint16_t end);
typedef void (* p_lv_obj_clear_flag)(lv_obj_t * obj, lv_obj_flag_t f);
typedef void (* p_lv_label_set_recolor)(lv_obj_t * obj, bool en);
typedef void (* p_lv_obj_set_style_text_letter_space)(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
typedef void (* p_lv_obj_set_style_text_line_space)(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);

typedef void (* p_lv_obj_set_width)(lv_obj_t * obj, lv_coord_t w);
typedef void (* p_lv_obj_set_style_text_align)(struct _lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector);
typedef struct _lv_api_t
{


	p_lv_obj_create f_lv_obj_create;
	p_lv_obj_clean f_lv_obj_clean;

	//style
	p_lv_obj_set_style_bg_color f_lv_obj_set_style_bg_color;
	p_lv_obj_set_style_pad_all f_lv_obj_set_style_pad_all;
	p_lv_obj_set_style_radius f_lv_obj_set_style_radius;
	p_lv_obj_set_style_border_width f_lv_obj_set_style_border_width;

	//obj prop
	p_lv_obj_align f_lv_obj_align;
	p_lv_obj_set_size f_lv_obj_set_size;
	p_lv_obj_align_to f_lv_obj_align_to;
	p_lv_obj_set_pos f_lv_obj_set_pos;
	p_lv_obj_set_scrollbar_mode f_lv_obj_set_scrollbar_mode;

	//img
	p_lv_img_create f_lv_img_create;
	p_lv_img_set_src f_lv_img_set_src;
	p_lv_img_set_pivot f_lv_img_set_pivot;
	p_lv_img_set_angle f_lv_img_set_angle;

	//timer
	p_lv_timer_create f_lv_timer_create;
	p_lv_timer_del f_lv_timer_del;

	//event
	p_lv_event_send f_lv_event_send;
	p_lv_obj_add_event_cb f_lv_obj_add_event_cb;
	p_lv_event_get_code f_lv_event_get_code;
	p_lv_event_get_target f_lv_event_get_target;
	p_lv_event_get_param f_lv_event_get_param;
	p_lv_event_get_user_data f_lv_event_get_user_data;

	//parent and child
	p_lv_obj_get_child_id f_lv_obj_get_child_id;
	p_lv_obj_get_parent f_lv_obj_get_parent;
	p_lv_obj_get_child f_lv_obj_get_child;

	//label
	p_lv_label_create f_lv_label_create;
	p_lv_label_set_text f_lv_label_set_text;
	p_lv_obj_set_style_text_font f_lv_obj_set_style_text_font;


	//other
	p_lv_mainUI_select_entry f_lv_mainUI_select_entry;

	lv_obj_t ** prj_parent;
	
	ipc_daily_data_t *p_sync_cm3;



	p_lv_style_init f_lv_style_init;
	p_lv_style_set_line_width f_lv_style_set_line_width;
	p_lv_style_set_line_color f_lv_style_set_line_color;
	p_lv_style_set_line_rounded f_lv_style_set_line_rounded;
	p_lv_line_create f_lv_line_create;
	p_lv_line_set_points f_lv_line_set_points;
	p_lv_obj_add_style  f_lv_obj_add_style;
	p_lv_arc_create f_lv_arc_create;
	p_lv_obj_set_style_arc_width f_lv_obj_set_style_arc_width;
	p_lv_obj_set_style_arc_color f_lv_obj_set_style_arc_color;
	p_lv_arc_set_end_angle f_lv_arc_set_end_angle;
	p_lv_arc_set_bg_angles f_lv_arc_set_bg_angles;


	p_lv_trigo_sin f_lv_trigo_sin;
	p_lv_trigo_cos f_lv_trigo_cos;


	p_lv_label_set_text_fmt f_lv_label_set_text_fmt;

	lv_font_t * font_min;
	lv_font_t * font_mid;
	lv_font_t * font_max;

	p_lv_font_get_glyph_dsc_fmt_txt f_lv_font_get_glyph_dsc_fmt_txt;
	p_lv_font_get_bitmap_fmt_txt f_lv_font_get_bitmap_fmt_txt;

	p_lv_tick_get f_lv_tick_get;
	p_lv_obj_is_valid f_lv_obj_is_valid;

	p_fr_system_get_time_week f_fr_system_get_time_week;

	p_lv_obj_set_style_text_color f_lv_obj_set_style_text_color;
    // new
    p_lv_obj_remove_style f_lv_obj_remove_style;
    p_lv_arc_set_angles f_lv_arc_set_angles;
    p_lv_obj_clear_flag f_lv_obj_clear_flag;
    p_lv_label_set_recolor f_lv_label_set_recolor;
    p_lv_obj_set_style_text_letter_space f_lv_obj_set_style_text_letter_space;
    p_lv_obj_set_style_text_line_space f_lv_obj_set_style_text_line_space;

    p_lv_obj_set_width f_lv_obj_set_width;
    p_lv_obj_set_style_text_align f_lv_obj_set_style_text_align;
}lv_api_t;


typedef struct _main_program_env{
    uint32_t version;
    
    struct {
        void *(*__malloc)(uint32_t size);
        void (*__free)(void *ptr);
    } mem_api;
    
    struct {
        int (*__printf)(const char* format, ...);
    } debug_api;

    void * img_addr;
    lv_obj_t * parent;
    void * arg;

    lv_api_t * lv_api;
}main_program_env_t;

//----------------------------------------------------------------
typedef int (* app_entry)(main_program_env_t * arg);


typedef void (* ui_entry)(lv_obj_t *obj, lv_point_t *top);


//#define PRI_UI_GROUP_NUM	20

typedef struct _lv_ui_group_t
{
	lv_coord_t ui_num;
	ui_entry * lay_ui;
}lv_ui_group_t;


// ui page stack
typedef struct 
{
	uint16_t mode_id : 4;
	uint16_t page_id : 12;
	uint16_t page_attr;
	int16_t	top_cur_x;
	int16_t	top_cur_y;
}ui_scene_t;


#define PG_STACK_LEN	10
typedef struct
{
	ui_scene_t ui[PG_STACK_LEN];
	int s_top;
}pg_stack_t;


extern lv_api_t ui_api;
extern p_main_clock * entry_main;
extern p_main_clock * entry_main1;
extern p_main_clock * entry_main2;
extern p_main_clock * entry_main3;
extern p_main_clock * entry_main4;


extern const lv_font_t arialuni_20;
extern lv_font_t bin_font;
extern void **font_addr;
extern void lv_init_bin_font(lv_font_t * font,const void * dsc,const lv_font_t * scr);
extern lv_point_t sys_scroll_sum;


//varable
extern ctp_type_t tp;
extern uint8_t key_code;
extern ipc_daily_data_t  sync_cm3_data;
//extern ipc_daily_data_t	volatile sync_cm3_data;
extern sleep_history_stru	sleep_history_data;
extern uint8_t sportheartrate_historydata[72];
extern uint8_t heartrate_historydata[];

extern lv_obj_t * prj_parent_cont;
extern lv_obj_t * prj_prev_cont;
extern lv_indev_t * indev_keypad;
extern ui_func pri_ui_group[];
extern uint8_t dsp_ipc_cmd;
extern lv_group_t *prj_group;
extern lv_obj_t *group_tail_obj;

extern uint8_t lv_transform_battery(uint16_t battery_value);

//system & timer & driver
extern void lvgl_main_task_timer_callback(void *arg);


//ui
extern void lv_guimain(lv_obj_t * obj);
extern void ui_main_float(lv_obj_t * parent);
extern void layer_main_cont(lv_obj_t * parent, ui_entry f_parent, ui_entry f_cont, ui_entry f_cont1);
extern void layer_left_cont(lv_obj_t * parent, ui_entry f_cont, ui_entry f_cont1);
extern void return_function(lv_obj_t * parent);


extern uint32_t CalcWeekday(time_rtc_t time);
extern void topbar_status_bt_baterrry_time(lv_obj_t * bar_bat,lv_obj_t * bar_time);

extern void dsp_post_operate_to_m3(uint8_t op_cmd,uint8_t *buffer,uint16_t len);

extern ancs_msg_t	msglist;
extern uint8_t msg_list_total;
extern call_record_list_t record_list;
extern uint8_t call_context[];
extern uint8_t call_list[];
extern uint8_t book_list[10][200];

extern uint32_t phone_book_total;


#define  m3_log   //dsp_printf_to_m3



#endif // __MAIN_H__

